package com.qys.wallet.service.impl;

import com.qys.wallet.model.entity.WalletCoinRecord;
import com.qys.wallet.mapper.WalletCoinRecordMapper;
import com.qys.wallet.pay.hyperbc.dto.resp.HyWlCollBackDTO;
import com.qys.wallet.service.WalletCoinRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * <p>
 * 地址出入账记录 服务实现类
 * </p>
 *
 * @author
 * @since 2023-09-25
 */
@Service
public class WalletCoinRecordServiceImpl extends ServiceImpl<WalletCoinRecordMapper, WalletCoinRecord> implements WalletCoinRecordService {

    @Override
    public void createRecord(HyWlCollBackDTO data,Byte incomeType) {
        WalletCoinRecord coinRecord=new WalletCoinRecord();
        coinRecord.setCoinName(data.getCoin());
        coinRecord.setAddress(data.getAddress());
        coinRecord.setAmount(new BigDecimal(data.getAmount()));
        coinRecord.setTotal(new BigDecimal(data.getTotal()));
        coinRecord.setFee(new BigDecimal(data.getFee()));
        coinRecord.setTradeId(data.getTrade_id());
        coinRecord.setCreateTime(System.currentTimeMillis());
        coinRecord.setTxid(data.getTxid());
        coinRecord.setIncomeType(incomeType);
        baseMapper.insert(coinRecord);
    }






}
